<?php

namespace models;

/**
 * Created by PhpStorm.
 * User: Yue
 * Date: 2017-8-23
 * Time: 1:14
 */
class User{

    public function test1(){
        echo "User model func test1()";
    }



    public static function getUserById($uid){
        $ci = & get_instance();
        $params = $ci->config->item('params');
        $users = $params["users"];

        foreach($users as $user){
            if($user["id"] == $uid){
                return $user;
            }
        }
        return null;
    }

    public static function getUserByUsername($username){
        $ci = & get_instance();
        $params = $ci->config->item('params');
        $users = $params["users"];

        foreach($users as $user){
            if($user["username"] == $username){
                return $user;
            }
        }
        return null;
    }

}